import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:life_service/color/hex.dart';
import 'package:life_service/utils/styles.dart';
import 'controller.dart';

class MineCouponsPage extends GetView<MineCouponsController> {
  const MineCouponsPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: HexColor(HexColor.colorF2f2),
      appBar: PreferredSize(
        preferredSize: Size.fromHeight(Get.mediaQuery.padding.top + 44),
        child: AnnotatedRegion<SystemUiOverlayStyle>(
          value: SystemUiOverlayStyle.dark,
          child: Container(
            padding: Get.mediaQuery.padding,
            alignment: Alignment.centerLeft,
            decoration: BoxDecoration(
              color: Colors.white,
              border: Border(
                bottom: BorderSide(
                  color: HexColor(HexColor.colorF2f2),
                ),
              ),
            ),
            child: TextButton(
              onPressed: Get.back,
              child: Text.rich(
                TextSpan(
                  children: [
                    const WidgetSpan(
                      child: Icon(
                        CupertinoIcons.chevron_back,
                        size: 18,
                        color: Colors.black,
                      ),
                    ),
                    TextSpan(
                      text: ' 我的评价',
                      style: StylesUtils.customTextStyle(
                        fontSize: StylesUtils.fontSize16,
                        color: HexColor.color3333,
                      ),
                    ),
                  ],
                ),
              ),
            ),
          ),
        ),
      ),
      body: SingleChildScrollView(
        child: Column(
          children: [
            for (var i = 0; i < 10; i++)
              Center(
                child: Container(
                  width: 336,
                  padding:
                      const EdgeInsets.symmetric(horizontal: 17, vertical: 15),
                  decoration: BoxDecoration(
                    color: Colors.white,
                    boxShadow: [
                      BoxShadow(
                        offset: const Offset(2, 0),
                        blurRadius: 15,
                        spreadRadius: 0,
                        blurStyle: BlurStyle.outer,
                        color: HexColor.rgba(242, 242, 242, 0.6),
                      )
                    ],
                    borderRadius: BorderRadius.circular(4),
                  ),
                  child: Column(
                    children: [
                      Row(
                        children: [
                          Text.rich(
                            TextSpan(
                              children: [
                                TextSpan(
                                  text: '￥',
                                  style: StylesUtils.customTextStyle(
                                    fontSize: StylesUtils.fontSize20,
                                    color: HexColor.colorFf62,
                                    fontWeight: FontWeight.w700,
                                  ),
                                ),
                                TextSpan(
                                  text: '10',
                                  style: StylesUtils.customTextStyle(
                                    fontSize: StylesUtils.fontSize48,
                                    color: HexColor.colorFf62,
                                    fontWeight: FontWeight.w700,
                                  ),
                                )
                              ],
                            ),
                          ),
                          Expanded(
                            child: Padding(
                              padding:
                                  const EdgeInsets.symmetric(horizontal: 10),
                              child: Column(
                                children: [
                                  Align(
                                    alignment: Alignment.centerLeft,
                                    child: Text(
                                      '10元专享立减券',
                                      style: StylesUtils.customTextStyle(
                                        color: HexColor.color3333,
                                        fontWeight: FontWeight.w700,
                                      ),
                                    ),
                                  ),
                                  Container(
                                    alignment: Alignment.centerLeft,
                                    margin: const EdgeInsets.only(top: 8),
                                    child: Text(
                                      '有效期至2019.08.06',
                                      style: StylesUtils.customTextStyle(
                                        color: HexColor.colorCccc,
                                        fontSize: StylesUtils.fontSize12,
                                      ),
                                    ),
                                  ),
                                ],
                              ),
                            ),
                          ),
                          TextButton(
                            onPressed: () {},
                            style: ButtonStyle(
                              fixedSize: const WidgetStatePropertyAll(
                                Size(75, 26),
                              ),
                              minimumSize: const WidgetStatePropertyAll(
                                Size(75, 26),
                              ),
                              backgroundColor: WidgetStatePropertyAll(
                                HexColor.rgba(255, 199, 28, 0.0980392156862745),
                              ),
                              shape: WidgetStatePropertyAll(
                                RoundedRectangleBorder(
                                  borderRadius: BorderRadius.circular(13),
                                  side: BorderSide(
                                    color: HexColor(HexColor.colorFf62),
                                  ),
                                ),
                              ),
                              alignment: Alignment.center,
                              padding:
                                  const WidgetStatePropertyAll(EdgeInsets.zero),
                              foregroundColor: const WidgetStatePropertyAll(
                                  Colors.transparent),
                            ),
                            child: Text(
                              '领取',
                              style: StylesUtils.customTextStyle(
                                fontSize: StylesUtils.fontSize12,
                                color: HexColor.colorFf62,
                              ),
                            ),
                          ),
                        ],
                      ),
                      Divider(
                        height: 30,
                        indent: 0,
                        endIndent: 0,
                        thickness: 2,
                        color: HexColor(HexColor.colorF2f2),
                      ),
                      Align(
                        alignment: Alignment.centerLeft,
                        child: Text(
                          '赠送新注册用户',
                          style: StylesUtils.customTextStyle(
                            fontSize: StylesUtils.fontSize12,
                            color: HexColor.colorCccc,
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              ).marginOnly(top: 15),
          ],
        ),
      ),
    );
  }
}
